package net.wwang.open;

import net.wwang.open.pojo.dto.UploadFileDTO;
import net.wwang.open.util.IDGenerateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

import javax.annotation.PostConstruct;
import java.util.TimeZone;

/**
 * @author WangWei
 * @date 2020/8/11
 */
@Slf4j
@SpringBootApplication
@EnableConfigurationProperties({UploadFileDTO.class})
public class OpenSiteApplication {
    public static void main(String[] args) {
        SpringApplication application = new SpringApplication(OpenSiteApplication.class);
        application.setBannerMode(Banner.Mode.CONSOLE);
        application.run(args);
    }

    /**
     * 时区设置
     */
    @PostConstruct
    void started() {
        TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
    }

    @Bean
    public IDGenerateUtil createIdWorker() {
        return new IDGenerateUtil(0, 0);
    }
}
